import React, { useState, useEffect } from 'react';
import {Button} from 'antd';
import style from './index.module.css';
import {get} from "../../utils/get";
import ListUI from "./ListUI";
const LastList = (props) => {
    const [data,setData]= useState([])
    const [loading,setLoading]=useState(true)
    useEffect(  () => {
        let isMounted =true;
        get('/share/board/latest').then(res => {
           if (isMounted&&res.data.code===0)
            setData(res.data.data)
        })
        if(isMounted)
        setLoading(false)
        return ()=>{
            isMounted=false;
        }
    }, [])

    const loadMore = loading ? (
        <div
            style={{
                textAlign: 'center',
                marginTop: 12,
                height: 32,
                lineHeight: '32px',
            }}
        >
            <Button className={`${style.moreButton}`}>loading more</Button>
        </div>
    ) : null;

    return (
        <ListUI data={data} type={1}></ListUI>
    )
}
export default LastList
